package com.example.controll.newsControll;

import com.example.config.R;
import com.example.domain.news;
import com.example.service.news.newService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/news")
public class newsControll {

    @Resource
    private newService newService;

    @RequestMapping("/findnews")
    private R fingnews(String openid){
        String userid="'"+openid+"'";

//        List<news> allnews = newService.findAllnews(userid);
        return new R(true,newService.findAllnews(userid));
    }

    @RequestMapping("/selectall")
    private R selectall(int a,int b,String name){
        name="'%"+name+"%'";
        return new R(true,newService.selectall(a,b,name));
    }

    @RequestMapping("/num")
    private R num(){
        return new R(true,newService.num());
    }

}
